import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'

//使用axios发请求 需要先导入axios对象，再挂载到vue对象上
//导入axios
import axios from "axios";
//import config from "vue/src/core/config";
Vue.config.productionTip = false;


axios.interceptors.request.use(config=>{
  var token = localStorage.getItem("token");
  if(token){
    //把token信息放入请求头中
    config.headers.token=token;
  }
  return config;
});
//挂载到vue
Vue.prototype.$http=axios;

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
